package com.shopping.mall.core.module.order.service;

import com.shopping.mall.base.http.Result;
import com.shopping.mall.core.module.cart.entity.Cart;
import com.shopping.mall.core.module.order.entity.GoodOrder;
import com.shopping.mall.core.module.order.entity.Order;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.shopping.mall.core.module.order.entity.OrderGood;

import java.util.List;

/**
 * <p>
 * Order服务类
 * </p>
 *
 * @author zzy
 * @date 2021-08-29
 */
public interface OrderService extends IService<Order> {

    /**
    * 分页查询
    * @param current：页码
    * @param size：每页条数
    * @param order：筛选条件
    * @return IPage<Order>
    */
    IPage<Order> getOrderPage(Integer current,Integer size,Order order);



    /**
     * 查询所有
     * @param order：筛选条件
     * @return List<Order>
     */
    List<Order> getAll(Order order);

    /**
     * 通过id删除
     * @param id：orderId
     * @return Result<Object>
     */
    Result<Object> deleteById(String id);

    /**
     * 批量删除
     * @param ids：id列表
     * @return Result<Object>
     */
    Result<Object> batchDelete(List<String> ids);

    /**
     * 创建订单
     * @param order：订单信息
     * @return Order
     */
    Result<Order> createOrder(Order order);

    /**
     * 提交订单
     * @param order
     * @return
     */
    Result<Object> add(Order order);


    Result<Object> payOrder(Order order);

    Result<Object> cancelOrder(String orderId);

    Result<Object> sendOrder(Order order);

    Result<Object> finishOrder(Order order);

    Result<Object> delivery(OrderGood orderGood);

    Result<Order> createGoodOrder(Cart cart);

    Result<Order> addGoodOrder(GoodOrder goodOrder);

    void autoFinish(String orderId);

    Result<Object> checkOrder(Order order);
}
